package com.maning.mndialoglibrary.config;


import ohos.agp.colors.RgbColor;
import ohos.agp.components.TableLayout;
import ohos.agp.components.element.PixelMapElement;
import ohos.agp.utils.Color;
import ohos.agp.utils.LayoutAlignment;

/**
 * Created by maning on 2017/8/11.
 * Toast自定义相关参数
 */
public class MToastConfig {


    public float toastTextSize = 13;
    public Color toastTextColor = Color.WHITE;
    public RgbColor toastBackgroundColor = null;
    public float toastBackgroundCornerRadius = 4.0f;
    public float toastBackgroundStrokeWidth = 0.0f;
    public Color toastBackgroundStrokeColor = Color.TRANSPARENT;
    public int toastGravity = LayoutAlignment.BOTTOM;
    public PixelMapElement toastIcon = null;
    //布局的Padding--int left, int top, int right, int bottom
    public int paddingLeft = 20;
    public int paddingTop = 12;
    public int paddingRight = 20;
    public int paddingBottom = 12;
    //图片宽高
    public int imgWidth = 20;
    public int imgHeight = 20;


    public MToastConfig() {
    }

    public static class Builder {

        private MToastConfig mToastConfig = null;

        public Builder() {
            mToastConfig = new MToastConfig();
        }

        public MToastConfig build() {
            return mToastConfig;
        }

        public Builder setTextColor(Color textColor) {
            mToastConfig.toastTextColor = textColor;
            return this;
        }

        public Builder setTextSize(float textSize) {
            mToastConfig.toastTextSize = textSize;
            return this;
        }

        public Builder setBackgroundColor(RgbColor backgroundColor) {
            mToastConfig.toastBackgroundColor = backgroundColor;
            return this;
        }

        public Builder setBackgroundCornerRadius(float radius) {
            mToastConfig.toastBackgroundCornerRadius = radius;
            return this;
        }

        public Builder setGravity(int toastGravity) {
            mToastConfig.toastGravity = toastGravity;
            return this;
        }

        public Builder setToastIcon(PixelMapElement ToastIcon) {
            mToastConfig.toastIcon = ToastIcon;
            return this;
        }

        public Builder setBackgroundStrokeWidth(float width) {
            mToastConfig.toastBackgroundStrokeWidth = width;
            return this;
        }

        public Builder setBackgroundStrokeColor(Color strokeColor) {
            mToastConfig.toastBackgroundStrokeColor = strokeColor;
            return this;
        }

        public Builder setImgWidthAndHeight(int imgWidth, int imgHeight) {
            mToastConfig.imgWidth = imgWidth;
            mToastConfig.imgHeight = imgHeight;
            return this;
        }

        public Builder setPadding(int paddingLeft, int paddingTop, int paddingRight, int paddingBottom) {
            mToastConfig.paddingLeft = paddingLeft;
            mToastConfig.paddingTop = paddingTop;
            mToastConfig.paddingRight = paddingRight;
            mToastConfig.paddingBottom = paddingBottom;
            return this;
        }

    }

}
